]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
system: Keep key focus when switching between alternatives
authorFlorian Müllner <fmuellner@gnome.org>
Sat, 26 Apr 2014 19:48:46 +0000 (21:48 +0200)
committerFlorian Müllner <fmuellner@gnome.org>
Tue, 6 May 2014 12:25:39 +0000 (14:25 +0200)
When switching between alternatives in AltSwitcher, the currently
visible child is replaced with the alternative. If the original
child has the key focus when it is removed from the stage, the
focus is lost. Detect this case and manually move the focus to
the new child.

https://bugzilla.gnome.org/show_bug.cgi?id=727259

js/ui/status/system.js

index 83eb92caf3bfcf4a3162781114e509b8e2ba4dde..b36c9d18ae43a82bdac2f61c9dbb4fdb68ce7183 100644 (file)
@@ -56,7 +56,10 @@ const AltSwitcher = new Lang.Class({
         }
 
         if (this.actor.get_child() != childToShow) {
+            let hasFocus = this.actor.contains(global.stage.get_key_focus());
             this.actor.set_child(childToShow);
+            if (hasFocus)
+                childToShow.grab_key_focus();
 
             // The actors might respond to hover, so
             // sync the pointer to make sure they update.